<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript">

	$(document).ready(function(){
		$("#adminExerciseOrderWayAddBtn").click(function(){
			var lastItemNo = $("#ExerciseAddTable tr:last").attr("class").replace("ExerciseOrderWayTr", "");
			
			var newitem = $("#ExerciseAddTable tr:eq(11)").clone();
			newitem.removeClass();
			newitem.find("td:eq(0)").attr("rowspan", "1");
			newitem.addClass("ExerciseOrderWayTr" + (parseInt(lastItemNo) + 1));
			
			$("#ExerciseAddTable").append(newitem);
		});
		
		$("#adminExerciseOrderRemoveBtn").live("click", function(){
			var clickedRow = $(this).parent().parent();
			var cls = clickedRow.attr("class");
			
		 	if(clickedRow.find("td:eq(0)").attr("rowspan")){
				if(clickedRow.next().hasClass(cls)){
					clickedRow.next().prepend(clickedRow.find("td:eq(0)"));
				}
			} 
			clickedRow.remove();
			
		});
		
	});


</script>


<div id="adminMode">
	<div id="ExerciseAdd">
		<h3>운동 추가</h3>
		<form id="ExerciseaddForm" name="ExerciseaddForm"
			action="board.spring" method="post">
			<table id="ExerciseAddTable" style="border: 1px solid gray; width: 800px; height: 60px;">
				<tr style="height: 50px">
					<td style="width: 200px">운동명 :</td>
					<td style="width: 200px"><input type="text" name="exerciseName"></td>
					<td style="width: 200px">운동 목적 :</td>
					<td style="width: 200px">
					<select name="exercisePurpose">
							<option value="H" >홈트레이닝</option>
							<option value="W" >Weight Training</option>
							<option value="Y" >요가</option>
							<option value="S" >스트레칭</option>
							<option value="D" >다이어트</option>
							<option value="A" >유산소 운동</option>
					</select></td>
				</tr>

				<tr style="height: 50px">
					<td style="width: 200px">운동 사진 :</td>
					<td style="width: 200px"><input type="button" value="사진추가">
					</td>
					<td>운동부위 :</td>
					<td>
					<select name="exerciseRegio">
							<option value="H" >전신 운동</option>
							<option value="W" >가슴 운동</option>
							<option value="Y" >등 운동</option>
							<option value="S" >어깨 운동</option>
							<option value="D" >삼두 운동</option>
							<option value="A" >이두 운동</option>
							<option value="A" >복근 운동</option>
							<option value="A" >허리 운동</option>
							<option value="A" >하체 운동</option>
					</select></td>
				</tr>

				<tr style="height: 50px">
					<td colspan="2" rowspan="4" style="border: 1px solid red"></td>
					<td>시간 :</td>
					<td><input type="text" name="exerciseAverageRuntime"></td>
				</tr>

				<tr style="height: 50px">
					<td>횟수 :</td>
					<td><input type="text" name="exerciseAverageNum"></td>
				</tr>

				<tr style="height: 50px">
					<td>세트수 :</td>
					<td><input type="text" name="exerciseAverageSetnum"></td>
				</tr>

				<tr style="height: 50px">
					<td>칼로리소모량(kcal) :</td>
					<td><input type="text" name="exerciseCalorieAverageconsum"></td>
				</tr>
				<tr style="height: 50px;">
					<td>운동 설명 :</td>
					<td colspan="3"><textarea cols="77" rows="3"
							name="exerciseInfomation"></textarea></td>
				</tr>
				<tr style="height: 50px">
					<td>주의 사항 :</td>
					<td colspan="3"><textarea cols="77" rows="3"
							name="exerciseNotice"></textarea></td>
				</tr>
				<tr style="height: 50px">
					<td>운동 팁 :</td>
					<td colspan="3"><textarea cols="77" rows="3"
							name="exerciseTip"></textarea></td>
				</tr>
				<tr>
					<td colspan="3">운동방법 :</td>
					<td align="center" style="padding: 0px 0px 0px 5px;">
						<button id="adminExerciseOrderWayAddBtn">운동방법추가</button></td>
				</tr>
			 	<tr class="ExerciseOrderWayTr1">
					<td></td>
					<td colspan="3">
						<input type="text" size="64" ><button id="adminExerciseOrderRemoveBtn">운동방법삭제</button></td>
				</tr>
			</table>
			<div id="adminExerciseAddBtn" style="margin: 10px 0px 10px 340px">
				<input type="button" value="추 가"
					onclick="javascript:adminExerciseAdd();" style="padding: 5px 15px">
				<input type="button" value="취 소" style="padding: 5px 15px">
			</div>
		</form>
	</div>
</div>